// Background image
var bgReady = false;
var bgImage = new Image();
bgImage.onload = function () {
bgReady = true;
};
bgImage.src = "images/background.png";

nuke = new Image();
nuke.src = "images/2.jpg";

// PLAYER
var playerReady = false;
var playerImage = new Image();
playerImage.onload = function () {
playerReady = true; upReady = true;
};
playerImage.src = "images/Playership.png";

// ENEMY1
var enemy1Ready = false;
var enemy1Image = new Image();
enemy1Image.onload = function () {
enemy1Ready = true;
};
enemy1Image.src = "images/Enemy1.png";

// ENEMY2
var enemy2Ready = false;
var enemy2Image = new Image();
enemy2Image.onload = function () {
enemy2Ready = true;
};
enemy2Image.src = "images/Enemy2.png";

// ENEMY3
var enemy3Ready = false;
var enemy3Image = new Image();
enemy3Image.onload = function () {
enemy3Ready = true;
};
enemy3Image.src = "images/Enemy3.png";

var menuim = new Image();
menuim.src = "images/menu.jpg";

var bulletimg = new Image();
bulletimg.src = "images/bullet.png";

function bullet(x, y) {
    this.x = x;
    this.y = y;
    this.draw = function () {
        ctx.drawImage(bulletimg,this.x,this.y);
    };
    this.move = function(z,s){
    	this.x += z;
    	this.y += s;
    	
    	if(this.x < 0){this.x = 1000;}
    };
    this.checkb = function (a) {
    if(this.x==a.x&&this.y>a.y+10){a.x=1200;a.y=Math.random()*500;}
};
};

function hostile(x, y,k) {
    this.x = x;
    this.y = y;
    var dead = 0;
    this.draw = function () {
        ctx.drawImage(k,this.x,this.y);
    };
    this.move = function(z){
    	this.x -= z;
    };
};

function createEnemies(yeah,k) {
        yeah.push(new hostile(1200, (Math.random()*canvas.height)-30,k));
};

function cbullet(a,q,w){a.push(new bullet(q,w));};



